debian/test.sh: factor out our dh_auto_test wrapper
authorSimon McVittie <smcv@debian.org>
Sun, 12 Jun 2016 13:49:25 +0000 (09:49 -0400)
committerSimon McVittie <smcv@debian.org>
Sun, 12 Jun 2016 13:49:25 +0000 (09:49 -0400)
Clean up any stray processes even if the test fails.

Signed-off-by: Simon McVittie <smcv@debian.org>
debian/changelog
debian/rules
debian/test.sh [new file with mode: 0755]

index be66d2ae59509c63ea64729832a3eff935c4a62d..083c30b77565d0302e43b7e374de5e40edb3258e 100644 (file)
@@ -4,6 +4,8 @@ ostree (2016.5-4) UNRELEASED; urgency=medium
     d/p/tests-Use-strict-mode-by-default-for-C-tests.patch: add patches
     to make sure the tests fail as soon as something goes wrong
   * Build-depend on procps, used to check for leaked processes
+  * debian/test.sh: factor out our dh_auto_test wrapper, and clean
+    up any stray processes even if the test fails
 
  -- Simon McVittie <smcv@debian.org>  Sat, 11 Jun 2016 19:52:40 +0100
 
index 2c6fae104f32f61ab4b4bb94bf48df0ab9cbeb8b..5edd70b3f057b90bd75ae48aac06c6ad2db0880f 100755 (executable)
@@ -26,14 +26,7 @@ override_dh_auto_configure:
        chmod +x tests/*.js
 
 override_dh_auto_test:
-       VERBOSE=1 dh_auto_test
-       # One test creates multiple GPG homedirs, each with its own agent
-       pkill --full "gpg-agent --homedir /var/tmp/tap-test\\.[^/]+/.*" || :
-       if pgrep lt-ostree || pgrep --full "gpg-agent --homedir /var/tmp/tap-test."; then \
-               echo "WARNING: daemon processes were leaked"; \
-               pgrep gpg-agent | xargs --no-run-if-empty ps ww; \
-               pgrep lt-ostree | xargs --no-run-if-empty ps ww; \
-       fi
+       debian/test.sh
 
 override_dh_auto_install:
        dh_auto_install
diff --git a/debian/test.sh b/debian/test.sh
new file mode 100755 (executable)
index 0000000..69e4f8d
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+export VERBOSE=1
+
+exit_status=0
+dh_auto_test || exit_status=1
+
+pkill --full "gpg-agent --homedir /var/tmp/tap-test\\.[^/]+/.*" || :
+
+if pgrep lt-ostree || pgrep --full "gpg-agent --homedir /var/tmp/tap-test."; then \
+    echo "WARNING: daemon processes were leaked"
+    pgrep gpg-agent | xargs --no-run-if-empty ps ww
+    pgrep lt-ostree | xargs --no-run-if-empty ps ww
+fi
+
+exit $exit_status
+
+# vim:set et sw=4 sts=4: